
## Functions
############################################################
function xcp(){
	 pname=$1
	 dpath=$2
   git clone https://git.oschina.net/$pname.git $dpath/temp
   mv $dpath/temp/* $dpath/
   rm -rf $dpath/temp
}
function xcp-zip(){
	 pname=$1
	 dpath=$2
	 fname=$3
   git clone https://git.oschina.net/$pname.git $dpath/temp
   unzip $dpath/temp/*.zip -d $dpath/temp/unzip
   mv $dpath/temp/unzip/* $dpath/$fname
   rm -rf $dpath/temp
}


## Parameters
############################################################

devPath=c:/xdev


## xtools
#xcp     xlxwhy/xtools-win-ant           $devPath
#xcp     xlxwhy/xtools-win-maven         $devPath
#xcp     xlxwhy/xtools-win-eclipse       $devPath
#xcp     xlxwhy/xtools-win-jdk8-u111     $devPath
#xcp-zip xlxwhy/xtools-win-mysql-5.7     $devPath   mysql


## MySQL
mysqlPort=1024
mysqlBaseFolder=$devPath/mysql
mysqlDataFolder=$devPath/mysql/data
mkdir $mysqlDataFolder
cp $devPath/mysql/my-default.ini $devPath/mysql/my.ini
echo -e "basedir=$mysqlBaseFolder\r\n" >>$mysqlBaseFolder/my.ini
echo -e "basedir=$mysqlDataFolder\r\n" >>$mysqlBaseFolder/my.ini
echo -e "port=$mysqlPort\r\n"          >>$mysqlBaseFolder/my.ini

echo -e "$mysqlBaseFolder/bin/mysqld --initialize --console\r\n"  >$mysqlBaseFolder/mysql-initialize.bat
echo -e "pause\r\n"  >>$mysqlBaseFolder/mysql-initialize.bat

echo -e "$mysqlBaseFolder/bin/mysqld --console\r\n"  >$mysqlBaseFolder/mysql-start.bat
echo -e "pause\r\n"  >>$mysqlBaseFolder/mysql-start.bat

echo -e "$mysqlBaseFolder/bin/mysql -P1024 -uroot -p\r\n"  >$mysqlBaseFolder/mysql.bat
echo -e "pause\r\n"  >>$mysqlBaseFolder/mysql.bat

#Old Password=Cr9dxzzEOZ#g
#New Password=ALTER USER 'root'@'localhost' IDENTIFIED BY 'new pwd';


